<!DOCTYPE html>

<html>
<head>
<meta charset="UTF-8">

<title>class AboutYou::SDK::Model::FacetGroup - RDoc Documentation</title>

<link href="../../../fonts.css" rel="stylesheet">
<link href="../../../rdoc.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
</script>

<script src="../../../js/jquery.js"></script>
<script src="../../../js/navigation.js"></script>
<script src="../../../js/search_index.js"></script>
<script src="../../../js/search.js"></script>
<script src="../../../js/searcher.js"></script>
<script src="../../../js/darkfish.js"></script>


<body id="top" role="document" class="class">
<nav role="navigation">
  <div id="project-navigation">
    <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2>
    <a href="../../../index.html" rel="home">Home</a>
  </h2>

  <div id="table-of-contents-navigation">
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

    <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

  </div>

  

  <div id="class-metadata">
    
    <div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  
  <p class="link">Object
  
</div>

    
    
    <!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    
    <li ><a href="#method-c-new">::new</a>
    
    <li ><a href="#method-i-add_facet">#add_facet</a>
    
    <li ><a href="#method-i-add_facets">#add_facets</a>
    
    <li ><a href="#method-i-contains">#contains</a>
    
    <li ><a href="#method-i-equal-3F">#equal?</a>
    
    <li ><a href="#method-i-facet_names">#facet_names</a>
    
    <li ><a href="#method-i-ids">#ids</a>
    
    <li ><a href="#method-i-unique_key">#unique_key</a>
    
  </ul>
</div>

  </div>
</nav>

<main role="main" aria-labelledby="class-AboutYou::SDK::Model::FacetGroup">
  <h1 id="class-AboutYou::SDK::Model::FacetGroup" class="class">
    class AboutYou::SDK::Model::FacetGroup
  </h1>

  <section class="description">
    
<p>This class represents a facet group model</p>

  </section>

  
  
  
  <section id="5Buntitled-5D" class="documentation-section">
    

    

    

    
    <section class="attribute-method-details" class="method-section">
      <header>
        <h3>Attributes</h3>
      </header>

      
      <div id="attribute-i-facets" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">facets</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>Array of instances of <a href="Facet.html">AboutYou::SDK::Model::Facet</a></p>
        
        </div>
      </div>
      
      <div id="attribute-i-group_id" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">group_id</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>id of the group of this facet group</p>
        
        </div>
      </div>
      
      <div id="attribute-i-id" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">id</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>id of this facet group</p>
        
        </div>
      </div>
      
      <div id="attribute-i-name" class="method-detail">
        <div class="method-heading attribute-method-heading">
          <span class="method-name">name</span><span
            class="attribute-access-type">[RW]</span>
        </div>

        <div class="method-description">
        
        <p>name of the facet group</p>
        
        </div>
      </div>
      
    </section>
    

    
     <section id="public-class-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Class Methods</h3>
       </header>

    
      <div id="method-c-new" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">new</span><span
            class="method-args">(id, name)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Constructor for the <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a> class</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>id</code> -&gt; the id of the facet group</p>
</li><li>
<p><code>name</code> -&gt; the name of the facet group</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>an instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a></p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">id</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">facets</span> = {}

  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
     <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
       <header>
         <h3>Public Instance Methods</h3>
       </header>

    
      <div id="method-i-add_facet" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">add_facet</span><span
            class="method-args">(facet)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method adds a facet to the facet group</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet</code> -&gt; instance of <a
href="Facet.html">AboutYou::SDK::Model::Facet</a> which should be added</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="add_facet-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_facet</span>(<span class="ruby-identifier">facet</span>)
  <span class="ruby-identifier">facets</span>[<span class="ruby-identifier">facet</span>.<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">facet</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-add_facets" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">add_facets</span><span
            class="method-args">(facets)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method adds facets to the facet group</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facets</code> -&gt; Array containing instances of <a
href="Facet.html">AboutYou::SDK::Model::Facet</a> which should be added</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="add_facets-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_facets</span>(<span class="ruby-identifier">facets</span>)
  <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">facet</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">add_facet</span>(<span class="ruby-identifier">facet</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-contains" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">contains</span><span
            class="method-args">(facet)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method checks if this facet group contains a facet</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet</code> -&gt; instance of <a
href="Facet.html">AboutYou::SDK::Model::Facet</a></p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Boolean determining whether this facet group contains the facet or not</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="contains-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 124</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">contains</span>(<span class="ruby-identifier">facet</span>)
  <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">facet</span>.<span class="ruby-identifier">id</span>)
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-equal-3F" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">equal?</span><span
            class="method-args">(facet_group)</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for checking whether a given facet group is equal to
this facet group</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>facet_group</code> -&gt; instance of <a
href="FacetGroup.html">AboutYou::SDK::Model::FacetGroup</a> used for
checking</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> : -Boolean determining whether the facet groups
are equal</p>
</li></ul>
          
          

          
          <div class="method-source-code" id="equal-3F-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 86</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">facet_group</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">facet_group</span>.<span class="ruby-identifier">id</span>

  <span class="ruby-identifier">unique_key</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">facet_group</span>.<span class="ruby-identifier">unique_key</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-facet_names" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">facet_names</span><span
            class="method-args">(separator = '/')</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>this method is used for getting all of the facet names of this facet group</p>
<ul><li>
<p><strong>Args</strong> :</p>
<ul><li>
<p><code>separator</code> -&gt; String controlling how the facet names should
be seperated</p>
</li></ul>
</li><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Array of Strings</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="facet_names-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">facet_names</span>(<span class="ruby-identifier">separator</span> = <span class="ruby-string">'/'</span>)
  <span class="ruby-identifier">names</span> = []
  <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">facet</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">names</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">facet</span>.<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">names</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">separator</span>)

  <span class="ruby-identifier">names</span>
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-ids" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">ids</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>Gett for the ids</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>Hash containing a pair of facet_group_id =&gt; Array of facet_ids</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="ids-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 111</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ids</span>
  { <span class="ruby-identifier">id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">keys</span> }
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
      <div id="method-i-unique_key" class="method-detail ">
        
        <div class="method-heading">
          <span class="method-name">unique_key</span><span
            class="method-args">()</span>
          
          <span class="method-click-advice">click to toggle source</span>
          
        </div>
        

        <div class="method-description">
          
          <p>This method is used for creating a unique key for this facet group</p>
<ul><li>
<p><strong>Returns</strong> :</p>
<ul><li>
<p>a String containing a unique key for this facet group</p>
</li></ul>
</li></ul>
          
          

          
          <div class="method-source-code" id="unique_key-source">
            <pre><span class="ruby-comment"># File lib/AboutYou/Model/facet_group.rb, line 98</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">unique_key</span>
  <span class="ruby-identifier">facet_ids</span> = <span class="ruby-identifier">facets</span>.<span class="ruby-identifier">keys</span>
  <span class="ruby-identifier">facet_ids</span>.<span class="ruby-identifier">sort!</span>

  <span class="ruby-constant">String</span>(<span class="ruby-identifier">id</span>) <span class="ruby-operator">+</span> <span class="ruby-string">':'</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>(<span class="ruby-identifier">facet_ids</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">','</span>))
<span class="ruby-keyword">end</span></pre>
          </div>
          
        </div>

        

        
      </div>

    
    </section>
  
  </section>
</main>


<footer id="validator-badges" role="contentinfo">
  <p><a href="http://validator.w3.org/check/referer">Validate</a>
  <p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.2.
  <p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer>

